package com.xu.Exception;

import com.xu.utils.JSONResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

/**
 * @author anan
 * @create 2022-03-07 15:59
 */
@RestControllerAdvice
public class CustomExceptionHandler {

    @ExceptionHandler(MaxUploadSizeExceededException.class)
    public JSONResult handlerMaxUploadFile(MaxUploadSizeExceededException exception){
        return JSONResult.errorMsg("文件上传大小不能超过500K，请压缩图片或者降低图片质量再上传！");
    }
}
